<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>盒子居中测试</title>
    <style>
        .father {
            width: 1000px;
            height: 400px;
            background-color: #ccc;
            margin:0 auto;
            text-align:center;
        }

        .son {
            /* margin: 0 auto; */
            color: red;
        }
    </style>
</head>

<body>
    <div class="father">
        <div class="son">
            123
        </div>
    </div>
</body>

</html>